function Core_KnowledgeBases(gui, user, date, options, message) {
  this._gui = gui;
  this._user = user;
  this._date = date;
  this._options = options;
  this._message = message;

  this._page = 1;
  this._order = 't.id';
  this._queue = 'ASC';
  
  this._createElements();
};

Core_KnowledgeBases.prototype._createElements = function() {
  var _self = this;
  this._knowledge = this._message['k'] ? this._message['k'] : null;
  this._type = this._message['type'];
  this._idx = this._message['idx'];
  
  DOMUtils.removeTableRows(this._gui.content, 0);
  DOMUtils.removeChildElements(this._gui.pagination);
  
  if (this._knowledge) {
    for (var i = 0, il = this._knowledge.d.length; i < il; i++) {
      var tmp = this._knowledge.d[i];
      var tr = this._gui.content.insertRow(-1);
      td = tr.insertCell(-1);
      td.style.width = '120px';
      td.style.height = '120px';
      var img = document.createElement('img');
      img.style.width = '120px';
      img.style.height = '120px';
      img.src = 'http://{{$smarty.const.DOMAIN|escape:'javascript'}}{{$smarty.const.PATH|escape:'javascript'}}' + 'custom/' + tmp.link;
      img.style.cursor = 'pointer';
      img._tmp = tmp;
      img.onclick = function() {};
      td.appendChild(img);
      td = tr.insertCell(-1);
      var table1 = document.createElement('table');
      table1.cellpadding = 0;
      table1.cellspacing = 0;
      table1.style.width = '880px';
      td.appendChild(table1);
      tr1 = table1.insertRow(-1);
      td1 = tr1.insertCell(-1);
      td1.style.fontSize = '16px';
      td1.style.color = '#707070';
      td1.innerHTML = tmp.title;
      tr1 = table1.insertRow(-1);
      td1 = tr1.insertCell(-1);
      td1.innerHTML = tmp.intro;
      tr1 = table1.insertRow(-1);
      td1 = tr1.insertCell(-1);
      var a = document.createElement('a');
      a.href = '?t=knowledgebase' + '&c=1' + '&i=' + this._idx + '&type=' + this._type + '&k=' + tmp.id;
      a.appendChild(document.createTextNode('View details'))
      td1.appendChild(a);
      
      var tr = this._gui.content.insertRow(-1);
      td = tr.insertCell(-1);
      td.colSpan=2;
      td.style.width = '1000px';
      var div = document.createElement('div');
      div.style.width = '1000px';
      div.innerHTML = '<hr size="1"/>';
      td.appendChild(div);
    }
  }
//  if (this._knowledge.t > this._knowledge.s) {
//    new ModulePagination(document, this._gui.pagination, 1000, 50, this._user, this._date, {page: this._knowledge.p, total: this._knowledge.t, limit: this._knowledge.s, callbackFunc: function(page) { location.href = '?t=knowledgebases&i=' + _self._idx + '&c=1' + '&type=' + _self._type + '&p=' + page; }, context: this});
//  }
  if (this._knowledge.t > this._knowledge.s) {
    new ModulePagination(document, this._gui.pagination, 1000, 50, this._user, this._date, {page: this._knowledge.p, total: this._knowledge.t, limit: this._knowledge.s, callbackFunc: function(page) { _self._page = page; _self._retrieveKnowledges.call(_self); }, context: this});
  }
};

Core_KnowledgeBases.prototype._retrieveKnowledges = function(pos) {
  var _self = this;
  var args = JSON.stringify([{type: this._type, size: 6, page: this._page}]);
  new RequestUtils()._custom('knowledgebases', args, function(result, params) { _self._message['k'] = result;
                                                                                _self._createElements();
                                                                              }, {php: 'custom/server.php', pos: (pos) ? pos : null});
};
